package com.entor.hqj.util;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;

import com.entor.hqj.login.LoginActivity;
import com.entor.hqj.main.SetupActivity;

/**
 * Created by Administrator on 2018/1/28 0028.
 */

public class AlterUtil extends Activity{
    private Context context = null;
    public AlterUtil(){}
    public AlterUtil(Context context){
        this.context = context;
    }
    public void  dialogShowOkCancel(){
        new AlertDialog.Builder(context)
                .setTitle("温馨提示")
                .setMessage("确定退出吗？")
                .setPositiveButton("确定",new DialogInterface.OnClickListener(){

                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        setResult(RESULT_OK);
                        dialogInterface.dismiss();
                        close();
                    }
                })
                .setNegativeButton("取消",new DialogInterface.OnClickListener(){
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        setResult(RESULT_CANCELED);
                        dialogInterface.dismiss();
                    }
                }).show();
    }

    public void close(){
        Intent intent = new Intent(context,LoginActivity.class);
        startActivity(intent);
    }

}
